package com.ruoyi.message.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.message.domain.MailToUser;
import com.ruoyi.message.mapper.MailToUserMapper;
import com.ruoyi.message.service.IMailToUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.text.Convert;

/**
 * 邮件收件人账号Service业务层处理
 * 
 * @author shushuang
 * @date 2019-10-18
 */
@Service
public class MailToUserServiceImpl implements IMailToUserService
{
    @Autowired
    private MailToUserMapper mailToUserMapper;

    /**
     * 查询邮件收件人账号
     * 
     * @param uuid 邮件收件人账号ID
     * @return 邮件收件人账号
     */
    @Override
    public MailToUser selectMailToUserById(String uuid)
    {
        return mailToUserMapper.selectMailToUserById(uuid);
    }

    /**
     * 查询邮件收件人账号列表
     * 
     * @param mailToUser 邮件收件人账号
     * @return 邮件收件人账号
     */
    @Override
    public List<MailToUser> selectMailToUserList(MailToUser mailToUser)
    {
        return mailToUserMapper.selectMailToUserList(mailToUser);
    }

    /**
     * 新增邮件收件人账号
     * 
     * @param mailToUser 邮件收件人账号
     * @return 结果
     */
    @Override
    public int insertMailToUser(MailToUser mailToUser)
    {
        mailToUser.setCreateTime(DateUtils.getNowDate());
        return mailToUserMapper.insertMailToUser(mailToUser);
    }

    /**
     * 修改邮件收件人账号
     * 
     * @param mailToUser 邮件收件人账号
     * @return 结果
     */
    @Override
    public int updateMailToUser(MailToUser mailToUser)
    {
        mailToUser.setUpdateTime(DateUtils.getNowDate());
        return mailToUserMapper.updateMailToUser(mailToUser);
    }

    /**
     * 删除邮件收件人账号对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteMailToUserByIds(String ids)
    {
        return mailToUserMapper.deleteMailToUserByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除邮件收件人账号信息
     * 
     * @param uuid 邮件收件人账号ID
     * @return 结果
     */
    public int deleteMailToUserById(String uuid)
    {
        return mailToUserMapper.deleteMailToUserById(uuid);
    }

    @Override
    public MailToUser findByUserIdAndMailUserName(Long userId, String mailUsername) {
        return mailToUserMapper.findByUserIdAndMailUserName(userId, mailUsername);
    }
}
